import React, { Component } from 'react'

export default class App extends Component {
 
  render() {
    return (
      <div>
        <div>
          姓名：<input type="text" ref="userName"/>
        </div>
        <div>
          密码：<input type="text" ref="password"/>
        </div>
        <div>
          头像<input type="file" ref="avatar"/>
        </div>
        <button onClick = { this.getData }>获取数据</button>
      </div>
    )
  }
  getData = () => {
    console.log({
      userName: this.refs.userName.value,
      password: this.refs.password.value
    })
  }
}
